var e = require("../../utils/util.js"), t = wx.createInnerAudioContext();

Component({
    properties: {
        url: {
            type: String,
            value: ""
        }
    },
    data: {
        isPaused: !0,
        lastTime: "",
        currentTime: 0,
        clearWaveInterval: null
    },
    methods: {
        pauseMuisc: function() {
            console.log("=============components=>pause"), t.pause(), this.setData({
                currentTime: t.currentTime
            }), this.setData({
                isPaused: !0
            }), t.offEnded(), t.offStop(), t.offTimeUpdate();
        },
        playRecord: function() {
            var a = this;
            t.src = this.properties.url, this.data.isPaused ? (t.play(), t.startTime = this.data.currentTime, 
            this.setData({
                isPaused: !1
            }), t.onEnded(function() {
                t.offTimeUpdate(), a.setData({
                    isPaused: !0,
                    currentTime: 0
                });
            }), t.onPlay(function() {
                t.onTimeUpdate(function() {
                    i(), a.data.clearWaveInterval = setTimeout(function() {
                        n();
                    }, 500);
                });
            })) : this.pauseMuisc();
            var i = function() {
                var i = t.currentTime, n = t.duration - i;
                a.setData({
                    lastTime: (0, e.formatSeconds)(n)
                }), clearTimeout(a.data.clearWaveInterval);
            }, n = function() {
                a.setData({
                    isPaused: !0
                });
            };
        }
    },
    ready: function() {
        console.log("=============ready1"), this.playRecord();
    },
    moved: function() {
        console.log("=============moved1");
    },
    detached: function() {
        console.log("=============detached1");
    },
    pageLifetimes: function() {}
});